<?php #блок ссылок постраничной навигации

class pagination extends Load_use
{
	function getBlock()
	{
		$html = $list = '';
		$pagination_param = $this->getParam( 'pagination_param' , 'pnum' );
		
		$arr = getPagination($this->getParam('total',0),$this->getParam('limit',0),$this->getParam('links_count',2),array('first_last_links'=>false,'pagination_url'=>PAGINATOR_LINK,'url_after'=>$this->getParam('url_after',''),'url_before'=>$this->getParam('url_before','')));
		if( $arr )
		{
			foreach( $arr as $ind => $link )
				if( is_numeric( $ind ) )
					$list .= '<li'.( $link == false ? ' class="selected"' : '' ).'>'.( $link == false ? $ind : '<a href="'.$link.'">'.$ind.'</a>' ).'</li>';
			
			$html =	'<ul class="page-navi">
						'.(!empty($arr['prev'])?'<li class="page-navi__arrow"><a href="'.$arr['prev'].'">&#8249;</a></li>':'')
						.(!empty($arr['first'])?'<li class="page-navi__arrow"><a href="'.$arr['first'].'">1</a></li><li>...</li>':'')
							.$list.
						(!empty($arr['last'])?'<li>...</li><li class="page-navi__arrow"><a href="'.$arr['last']['link'].'">'.$arr['last']['num'].'</a></li>':'')
						.(isset($arr['next'])?'<li class="page-navi__arrow"><a href="'.$arr['next'].'">&#8250;</a></li>':'').'
					</ul>';
		}
		return $html;
	}
}